package cz.muni.fi.pa165.pokemon.dao;

import cz.muni.fi.pa165.pokemon.entity.Trainer;
import java.util.List;

/**
 * This is Data Access Object interface for Trainer entity. 
 * It describes CRUD methods and also few methods for finding specific
 * entities.
 *
 * @author Jan Koščák (xkoscak@gmail.com)
 */
public interface TrainerDAO {

    /*
     * This constructor creates new persist trainer entity using parameter trainer of
     * type Trainer. Also sets generated ID to the entity.
     *
     * @param trainer Trainer entity to be persisted
     * @throws IllegalArgumentException if trainer is null and/or if trainer has null
     * ID
     */
    void create(Trainer trainer);

    /**
     * Finds trainer in database using trainer id.
     *
     * @param id id of entity
     * @return Certain trainer or null if not found
     * @throws IllegalArgumentException if id is null
     */
    Trainer get(Long id);

    /**
     * Updates extra trainer information. Its ID must be non-null.
     * 
     * @param trainer Trainer information to be updated
     * @throws IllegalArgumentException if trainer is null and/or its id is null                  
     */
    void update(Trainer trainer);

    /**
     * Removes given trainer from our database.
     * 
     * @param trainer Certain trainer to be removed
     */
    void remove(Trainer trainer);

    /**
     * This method finds all trainers in our database.
     * 
     * @return List of all trainers
     */
    List<Trainer> findAll();

     /**
     * Finds all trainers with same name.
     * 
     * @param name Name of trainer
     * @return List of trainers with same name
     * @throws IllegalArgumentException if name is null
     */
    List<Trainer> findByName(String name);
}
